import Vue from 'vue'
import moment from 'moment'
import 'moment/locale/zh-cn'

// 时间格式化
export function formatTime(value, format) {
  return value ? moment(value - 0).format(format || 'YYYY-MM-DD H:mm:ss') : ''
}

const filters = {
  formatTime,
}

Object.keys(filters).forEach((key) => {
  Vue.filter(key, filters[key])
})
export default filters
